package com.tos.second.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tos.second.entity.Orders;
import com.tos.second.entity.User;
import com.tos.second.vo.OrdersHistoryVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface OrdersMapper extends BaseMapper<Orders> {
    void saveOrder(Orders orders);

    @Select("select * from orders where buyer_id = #{currentId} order by order_time desc")
    List<Orders> getMyBuyList(Long currentId);

    void remove(Long buyerId);

    void removeById(Long id);

    void updateStatus(String number, int status);

    User getById(String number);

    Long getSellerIdByNumber(String number);

    Long getGoodsId(String number);

    int deleteExpiredUnpaidOrdersByTime(@Param("expireTime") LocalDateTime expireTime);

    int deleteUnpaidOrderByNumber(@Param("orderNumber")String orderNumber);

    List<OrdersHistoryVo> getMySellList(Long currentId);

    Orders getOrderByNumber(String number);
}
